package com.zdkj.subway.rca.util.excel;


import lombok.extern.slf4j.Slf4j;
import org.apache.poi.ss.formula.functions.T;
import org.apache.poi.ss.usermodel.Sheet;

import javax.sql.DataSource;
import java.util.List;

/**
 * @ProjectName: zdkj
 * @Package: com.zdkj.subway.st.exceltools
 * @ClassName: AbstractExcelParser
 * @Description:
 * @Author: kangjian
 * @CreateDate: 2020/1/12 9:32
 * @Version: 1.0
 */
@Slf4j
public class RcaCommonExcelParse  extends RcaAbstractExcelParser implements RcaIExcelParser<T> {
    /*
     * 根据导入的Excel解析数据
     * @param sheet excel工作簿
     * @param ds   数据源
     * @param obj   要转换的entity对象
     * (non-Javadoc)
     * @see com.zdkj.common.core.exceltools.IExcelParser#parse(org.apache.poi.ss.usermodel.Sheet, javax.sql.DataSource, java.lang.Object)
     * @return List
     */
	@Override
    public <T> List<T> parse(Sheet sheet, DataSource ds, T obj, int rowNum, int count) {
        List<T> result= null;
        try {
            result = super.importBaseExcel(sheet,obj,rowNum,count);
        } catch (Exception e) {
            log.error("",e);
        }
        return result;
    }

    /*
     * 根据导入的Excel解析数据
     * @param sheet excel工作簿
     * @param obj   要转换的entity对象
     * (non-Javadoc)
     * @return List
     * @see com.zdkj.common.core.exceltools.IExcelParser#parse(org.apache.poi.ss.usermodel.Sheet, java.lang.Object)
     */
    @Override
    public <T> List<T> parse(Sheet sheet, T obj, int rowNum, int count) {
        List<T> result=this.parse(sheet,null,obj,rowNum,count);
        return result;
    }
}
